<template>
  <div class="reply-cmt">
    <template v-for="item in comments" :key="item.parentCommentId">
      <div class="comment">
        <div class="avatar">
          <img :src="item.user.avatarUrl" alt="404" />
        </div>
        <div class="top">
          <div class="t-nick">
            <span class="nickname">{{ item.user.nickname }}</span>
            <span class="time">{{ $filters.formatTime(item.time) }}</span>
          </div>
          <div class="content">回复我: {{ item.content }}</div>
          <div class="my-cmt">{{ item.beRepliedContent }}</div>
        </div>
      </div>
    </template>
  </div>
</template>

<script setup lang="ts">
import { defineProps, withDefaults } from 'vue'

const props = withDefaults(
  defineProps<{
    comments: any
  }>(),
  {
    comments: []
  }
)
</script>

<style scoped lang="less">
.reply-cmt {
  width: 100%;
  .comment {
    width: 100%;
    padding: 6px 8px;
    display: flex;
    border-bottom: 1px solid #e5e5e5;
    cursor: pointer;
    margin-top: 6px;
    .avatar {
      margin-right: 8px;
      width: 35px;
      img {
        width: 35px;
        height: 35px;
        border-radius: 50%;
      }
    }
    .top {
      flex: 1;
      padding-right: 8px;
      .t-nick {
        display: flex;
        justify-content: space-between;
        margin-bottom: 3px;
        .nickname {
          color: #507daf;
          font-size: 14px;
        }
        .time {
          font-size: 12px;
          color: #e5e5e5;
        }
      }
      .content {
        width: 260px;
        margin-top: 8px;
        font-size: 13px;
        color: #333;
        line-height: 19px;
      }
      .my-cmt {
        margin-top: 5px;
        background: #f4f4f4;
        font-size: 12px;
        color: #333;
        padding: 8px 10px;
      }
    }
  }
}
</style>
